<template>
  <view class="container">
    <view class="title">{{formatDate(new Date(STEP1_BDATE),'yyyy年MM月')}}低保申请工作</view>
    <view class="tips" v-if="isok">请于{{formatDate(new Date(STEP1_BDATE),'yyyy年MM月dd日')}}~{{formatDate(new Date(STEP1_EDATE),'yyyy年MM月dd日')}}<br>完成申请/资料填报/人脸验证工作</view>
    <view class="tips" v-else>当前时间不在低保申请日期范围内</view>
    <view class="butList">
      <navigator url="./agreement" class="but" v-if="isok" open-type="navigate">未享受{{CLASS2}}，申请享受</navigator>
      <navigator url="./adjustment" class="but but1" v-if="isok" open-type="navigate">已享受{{CLASS2}}，申请调整</navigator>
      <navigator url="./applyQuery" class="but but2" v-if="isok" open-type="navigate">上月已享受{{CLASS2}}，本月完成人脸验证</navigator>
    </view>
  </view>
</template>

<script>
  import { formatDate } from '@/utils/date.js'
  export default {
    data() {
      return {
        isok: false,
        CLASS2: '',
        STEP1_BDATE: '',
        STEP1_EDATE: ''
      }
    },
    onLoad() {
      let that = this;
      uni.getStorage({
          key: 'navdata',
          success: function (res) {
              that.CLASS2 = res.data.CLASS2
          }
      });
      uni.showLoading({
          title: '加载中'
      });
      this.$http.get('checknow').then(res => {
        this.STEP1_BDATE = res.data.STEP1_BDATE.replace(/-/g, '/')
        this.STEP1_EDATE = res.data.STEP1_EDATE.replace(/-/g, '/')
        if(res.data.code == 0){
          this.isok = true
        }
        uni.hideLoading()
      })
    },
    methods: {
      formatDate
    }
  }
</script>

<style lang="scss" scoped>
.container {
  width: 100%;
  box-sizing: border-box;
  display: block;
  text-align: center;
  color: #101010;
  .title{
    font-size: 44upx;
    font-weight: 500;
    display: block;
    padding: 40upx 0 20upx 0;
    text-align: center;
  }
  .tips{
    color: #E51C23;
    font-size: 32upx;
  }
  .butList{
    text-align: center;
    margin-top: 90upx;
    .but{
      border-radius: 10upx;
      height: 80upx;
      font-weight: 500;
      line-height: 80upx;
      width: 95%;
      margin: 0 auto;
      color: #fff;
      font-weight: bold;
      background-color: rgb(10, 190, 124);
      margin-bottom: 30upx;
      font-size: 32upx;
      border: solid 1px rgb(10, 190, 124);
      &.but1{
        background-color:#2e82ff;
        border: solid 1px #2e82ff;
      }
      &.but2{
        background-color:cadetblue;
        border: solid 1px cadetblue;
      }
    }
  }
}
</style>
